package com.jpyl.jpMedicalTreatment.manager;

import android.app.Activity;

import com.jpyl.jpMedicalTreatment.MedicalApplication;

/**
 * Created by suyongli on 2016/1/19.
 */
public class ActivityManager {
    private static MedicalApplication application;
    private static Activity activity;

    public ActivityManager() {

    }

    public static final ActivityManager getInstance(Activity a) {
        activity = a;
        application = ((MedicalApplication) (a.getApplicationContext()));
        return SingletonHolder.INSTANCE;
    }

    public void onCreate() {
        application.activities.add(activity);
    }

    public void onDestroy() {
        application.activities.remove(activity);
    }

    private static class SingletonHolder {
        private static final ActivityManager INSTANCE = new ActivityManager();
    }
}
